//
//  ImagesTableViewCell.m
//  10-Homework
//
//  Created by dllo on 16/7/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ImagesTableViewCell.h"
#import "UIView+ChangeFrame.h"
@interface ImagesTableViewCell ()
@property (nonatomic, strong) UIImageView *leftImageView;
@property (nonatomic, strong) UIImageView *middleImageView;
@property (nonatomic, strong) UIImageView *rightImageView;
@end

@implementation ImagesTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _leftImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        _leftImageView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_leftImageView];
        
        _middleImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        _middleImageView.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_middleImageView];
        
        _rightImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        _rightImageView.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_rightImageView];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat topMargin = 5;
    CGFloat bottomMargin = 5;
    _leftImageView.frame = CGRectMake(0, topMargin, self.contentView.z_width * 1 / 3, self.contentView.z_height - topMargin - bottomMargin);

    _middleImageView.frame = CGRectMake(_leftImageView.z_width, topMargin, _leftImageView.z_width, _leftImageView.z_height);
    
    _rightImageView.frame = CGRectMake(_middleImageView.z_width + _middleImageView.z_x, topMargin, _leftImageView.z_width, _leftImageView.z_height);
}
@end
